/*
 * @Author: taoyuqing
 * @Date: 2022-12-26 20:56:24
 * @Description: 所有游戏
 */
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:spree/utils/utils.dart';

import '../../widgets/gameGroup/grid_imgs.dart';

class ActivityPage extends StatefulWidget {
  ActivityPage({Key? key}) : super(key: key);

  @override
  State<ActivityPage> createState() => _ActivityPageState();
}

class _ActivityPageState extends State<ActivityPage> with AutomaticKeepAliveClientMixin{
  final List _games = [
      {'img': 'images/game7.png','name':'Crash'},
   {'img': 'images/game8.png','name':'Dice'},
   {'img': 'images/game9.png','name':'Mines'},
   {'img': 'images/game10.png','name':'Double'},
   {'img': 'images/game11.png','name':'Double'},
   {'img': 'images/game22.png','name':'Double'},
   {'img': 'images/game23.png','name':'Double'},
   {'img': 'images/game24.png','name':'Double'},
   {'img': 'images/game26.png','name':'Double'},
   {'img': 'images/game25.png','name':'Double'},
   {'img': 'images/game27.png','name':'Double'},
   {'img': 'images/game28.png','name':'Double'},
    // 'images/game7.png',
    // 'images/game8.png',
    // 'images/game9.png',
    // 'images/game10.png',
    // 'images/game11.png',
    // 'images/game22.png',
    // 'images/game23.png',
    // 'images/game24.png',
    // 'images/game26.png',
    // 'images/game25.png',
    // 'images/game27.png',
    // 'images/game28.png',
  ];
  @override
  Widget build(BuildContext context) {
    double screenW = Utils().getScreenWidth(context);
    return Scaffold(
      appBar: AppBar(
        centerTitle: true,
        title: SvgPicture.asset('images/BETSPREELOGO.svg'),
      ),
      body: Container(
        padding: EdgeInsets.only(left: 20, right: 20,bottom: 5),
        decoration: BoxDecoration(
            color: Utils().createMaterialColor(),
            image: const DecorationImage(
                image: AssetImage(
                  'images/stars.png',
                ),
                fit: BoxFit.fill)),
        child: ListView(
          children: [
            Container(
              padding:
                  EdgeInsets.only(top: 30, bottom: 30, left: 60, right: 60),
              child: Image.asset(
                'images/OriginalGAMES.png',
              ),
            ),
            GridImgs(
              ontap: (data){
                try {
                  Navigator.pushNamed(context, data['name']);
                } catch (e) {
                  
                }
              },
              games: _games,
            )
          ],
        ),
      ),
    );
  }
  
  @override
  // TODO: implement wantKeepAlive
  bool get wantKeepAlive => true;
}
